package com.cyp.orderservice.controller;

import com.cyp.common.result.ResultData;
import com.cyp.orderservice.entity.SpringCloudAllData;
import com.cyp.orderservice.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/order")
public class OrderController {


    @Autowired
    private OrderService orderService;
    @GetMapping("/order")
    public String createOrder() {
        return "order";
    }
    @GetMapping("/testOrderSentinelController")
    public ResultData<String> testOrderSentinelController() {
        return orderService.testOrderSentinel();
    }
    @PostMapping("/createOrder")
    public String createOrder(Long userId,Long productId,int quantity,String amount) {
        return orderService.createOrder( userId, productId, quantity, amount);
    }
    @GetMapping("/getAllData")
    public SpringCloudAllData getAllData() {
        return orderService.getAllData();
    }

}
